from netmiko import Netmiko
from netmiko import ConnectHandler 
import netmiko
import os
# h3cdemo1 = ConnectHandler(
#     device_type="hp_comware",
#     host="172.168.10.10",
#     username="admin",
#     password="admin",
#     port=22,
# )

h3cdemo2 = {
    'device_type' : 'hp_comware',
    'host':'172.168.10.10',
    'username':'admin',
    'password':'admin',
    'port':22,
    'session_log':'demo2.txt'
}

# print(h3cdemo1)


# ----------------------------------！！！！！！-----------------
# output = h3cdemo1.send_command(
#     "display ip interface brief"
#     )
# ----------------------------------！！！！！！-----------------

# # ----------------------------------！！！！！！-----------------
# connfig = ["display ip interface brief","display clock"]
# output = h3cdemo1.send_config_set(
# config_commands=connfig,
# # exit_config_mode=True
# # )
# print(output)
# ----------------------------------！！！！！！-----------------

# -------------------调用巡检文件来进行巡检----------------
# session_log='demo.txt'

# ----------------------
# 巡检命令写入txt
def red_file_config(file_path):
        os.path=file_path();





with ConnectHandler(**h3cdemo2) as connect:
    
    output2=connect.session_log.file_name
    # 这里config_file是固定的，不能自定义
    output = connect.send_config_from_file(config_file='./gitdemo/h3cxunjian/demo/1.txt') 
    
    print("这里是巡检的内容:",end='\n')
    print(output2)
    
    # test
